﻿Imports DTO
Imports BUS

Public Class frmcapnhatbangcap

    Public Sub LoadBangCap()
        dtgvbangcap.Rows.Clear()
        Dim ds As New List(Of BangCapDTO)()
        Dim bus As New BangCapBUS()
        ds = bus.LayDSBangCap()
        For i As Integer = 0 To ds.Count - 1
            dtgvbangcap.Rows.Add(ds(i).MaBangCap, ds(i).TenBangCap)
        Next
    End Sub

    Private Sub frmcapnhatbangcap_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadBangCap()
    End Sub

    Private Sub btncapnhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncapnhat.Click
        If dtgvbangcap.CurrentRow.Index >= 0 Then
            Dim frm As New frmxlcapnhatbangcap()
            frm.MaBangCap = dtgvbangcap.Item(0, dtgvbangcap.CurrentRow.Index).Value
            frm.TenBangCap = dtgvbangcap.Item(1, dtgvbangcap.CurrentRow.Index).Value
            If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
                LoadBangCap()
            End If
        Else
            MessageBox.Show("Chưa chọn bằng cấp !")
        End If
    End Sub

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub
End Class